
import AbsMenu from '../absmenu.js'
import globalConst from '../../../canvas/common/globalConst.js';
var global = globalConst.GlobalConst;
class AnimateMenu extends AbsMenu.AbsMenu {
    constructor(map, item) {
        super(map, item);
    }

    act2Click() {
        console.log("AnimateMenu-----+" + this.menuSubItem);
        var tool = 0;
        switch (this.menuSubItem) {
            case 'start':
                window.loopHandle = window.requestAnimationFrame(window.animateLoopCalBack);
                break;
            case 'stop':
                window.cancelAnimationFrame(window.loopHandle);
                break;
            case 'rotate':
                this.setAnimateRotate();
                break;

            case 'inflate':
                this.setAnimateInflate();
                break;

            case 'piston':
                this.setAnimatePiston();
                break;

            default:
                break;
        }
    }


    setAnimatePiston() {
        let t = window.PistonMotionDlg.value;
        if (t && !t.visible) {
            t.visible = true;
            t.mapctrl = this.map;
        }
    }

    setAnimateRotate() {
        let t = window.RotateAnimateDlg.value;
        if (t && !t.visible) {
            t.visible = true;
            t.mapctrl = this.map;
        }
    }

    setAnimateInflate() {
        let t = window.InflateAnimateDlg.value;
        if (t && !t.visible) {
            t.visible = true;
            t.mapctrl = this.map;
        }
    }
}

export default { AnimateMenu }

